using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;

namespace ImageLib.Shell.ViewModel
{
    public class CommandItem<T>
    {
        private Action<T> _clickAction;

        public CommandItem(T item, Action<T> clickAction)
        {
            Item = item;
            _clickAction = clickAction;
            ClickCommand = new RelayCommand(ExecuteClickCommand);
        }

        public T Item { get; private set; }
        public RelayCommand ClickCommand { get; private set; }

        private void ExecuteClickCommand()
        {
            _clickAction(Item);
        }
    }
}
